package com.yqy.spring.service;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Component
@Aspect
@Order(2)
public class SecurityAspect {
    @Before("com.yqy.spring.service.LogAspect.pointCut()")
    public void beforeAdvice(){
        System.out.println("Security：前置通知~");
    }
    @AfterReturning("com.yqy.spring.service.LogAspect.pointCut()")
    public void afterReturningAdvice(){
        System.out.println("Security：后置通知~");
    }
    @Around("com.yqy.spring.service.LogAspect.pointCut()")
    public void aroundAdvice(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        System.out.println("Security：环绕通知开始~");
        proceedingJoinPoint.proceed();
        System.out.println("Security：环绕通知结束~");
    }
    @After("com.yqy.spring.service.LogAspect.pointCut()")
    public void afterAdvice(){
    System.out.println("Security：最终通知~");
    }
    @AfterThrowing("com.yqy.spring.service.LogAspect.pointCut()")
    public void afterThrowingAdvice(){
        System.out.println("Security：异常通知~");
    }
}
